package com.rd.student.ruanjian.class3.gaochenxi.NumberFIve;

import java.util.LinkedList;

public class NumberFive {
      public static void main(String[] args) {
            String[] strs = {"12345", "67891", "123478099", "9876543", "67891", "12347809933", "12809933", "12347809933111", "9876543", "12809933"};
            LinkedList func = NumberFive.Func(strs);
            System.out.println("重复元素删除前:");
            System.out.println(func);
            System.out.println("开始删除重复元素:");
            NumberFive.removeChong(func);
      }

      public static LinkedList Func(String[] strings) {
            LinkedList list = new LinkedList();
            for (int i = 0; i < strings.length; i++) {
                  list.add(strings[i]);//已经将集合中的字符串元素全部添加完毕
            }
           return list;
      }

      public static void removeChong(LinkedList list) {
            for (int i = 0; i < list.size(); i++) {
                  for (int j = 0; j < list.size(); j++) {
                        if (i != j && list.get(i) == list.get(j)) {
                              list.remove(list.get(j));
                        }
                  }
            }
            System.out.println(list);
      }
}
